package org.lego4j;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * Annotate a method with this annotation, to retry a method execution when an 
 * exception is thrown.  
 *
 * @author <a href="alexei.guevara@objectivedesigns.ca">Alexei Guevara</>
 * @version $Revision:$ updated on $Date:$ by $Author:$
 */
@Target( ElementType.METHOD )
@Retention( RetentionPolicy.RUNTIME )
public @interface RetryOnException {
    
    /**
     * @return Retries will be attempted only if the exception thrown is a kind of this class.
     */
    public Class<? extends Exception>[] e();
    
    /**
     * @return Number of times the method execution will be retried, if an exception is thrown.
     */
    public int retries() default 1;

    /**
     * @return The delay between retries in milliseconds.
     */
    public long delay() default 0;

}
